package com.bdqn.t320.controller;

import com.bdqn.t320.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping(value = "/user")
public class UserController {

    //@GetMapping(value = "/view")
    //@PostMapping(value = "/view")
    @RequestMapping(value = "/view")
    public String view(Model model, @RequestParam(value = "name", required = true) String realName,
                       String pwd) {
        System.out.println("view");
        System.out.println("realName:" + realName);
        System.out.println("pwd:" + pwd);
        User user = new User();
        user.setId(100);
        user.setName(realName);
        user.setPwd(pwd);
        //model.addAttribute("user",user);
        model.addAttribute(user);
        return "view";
    }
}
